<template>
  <div class="content">
     <header>
      <ul><li @click="back()" class="grey"><img class="back-icon" src="~assets/img/icon_l@2x.png" alt=""> 返回</li><li><h2 style="font-size:16px">{{$parent.title}}</h2></li><li></li></ul>
    </header>
    <ul class="basic_info">
    <router-link to='/new_name' tag='li'>姓名 <div style="float:right"><span style="margin-right:8px">{{account_info.name}}</span><img style="line-height:36px" class="more-icon" src="~assets/img/icon-r@2x.png" alt=""></div></router-link>
    <li>等级<span class="name">{{account_info.level | garde_name}}</span></li>
    <li>推荐人<span class="name"> ({{account_info.p_uname}}){{account_info.p_uid}}</span></li>
    <li>接点人<span class="name"> ({{account_info.name}}){{account_info.uid}}</span></li>
    </ul>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  data () {
    return {
      account_info: ''
    }
  },
  mounted () {
    this.$apiPost('userinfo',{}).then((data) => {
      this.account_info = data.data.account_info
    })
    axios.post('userinfo', {'uid': '279', 'token': 'ad704962160d5c5f5e3774d7d16d278d'}).then((data) => {
      console.log(data)
    })
  },
  methods: {
    back () {
      this.$router.push('/user_info')
    }
  },
  filters: {
    garde_name (str) {
      if (str === 1) {
        return '银卡'
      } else if (str ===2 ) {
        return '金卡'
      } else if (str ===3 ) {
        return '钻石'
      } else if (str ===4 ) {
        return 'VIP'
      }
    }
  }
}
</script>
<style scoped lang='scss'>
  .basic_info{
    width: 100%;
    height:auto;
    padding: 0 16px 0 16px;
    background: #fff;
    margin-top: 10px;
    li{
      width: 100%;
      height:54px;
      line-height: 54px;
      color: #000;
      font-size: 14px;
      border-bottom:1px solid #E5E5E5;
      &:nth-of-type(4){
        border:none
      }
      .name{
        float: right;
        color: #666;
        font-size: 12px;
      }
    }
  }
</style>
